package com.gzmu.storage.serviceImpl;

import com.gzmu.storage.config.MyRealm;
import com.gzmu.storage.entity.Adminlog;
import com.gzmu.storage.mapper.AdminlogMapper;
import com.gzmu.storage.service.AdminlogService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author xiaobo Yan
 * @since 2020-04-16
 */
@Service
public class AdminlogServiceImpl extends ServiceImpl<AdminlogMapper, Adminlog> implements AdminlogService {
    @Autowired
    private AdminlogMapper adminlogMapper;
    @Override
    public boolean insertAdminlog(String log) {
        Adminlog adminlog = new Adminlog();
        adminlog.setUserid( MyRealm.user.getId().toString() );
        adminlog.setContent( MyRealm.user.getNickname() + "-" + log );
        adminlog.setCreatetime( new Date() );
        adminlogMapper.insert( adminlog );
        return false;
    }
}
